import { ResouceConst } from "../../../../component/gconst/ResouceConst";
import { ImagesConst } from "../../../resource/ImagesConst";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { Language } from "../../../../../extend/language/Language";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { SkillItem } from "../SkillItem";
import { Cache } from "../../../cache/Cache";
import { FlyFootTxt } from "../../mapUI/flyFoot/FlyFootTxt";
import { DailyItemConfig } from "../../../resource/DailyItemConfig";
import { DailyRule } from "../../../rules/DailyRule";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { SkillInfo } from "../../../model/SkillInfo";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
//class SkillBaseOrePanel
    
    export  class SkillBaseOrePanel /* flash.display.Sprite */
    {
        constructor()
        {
            
            var loc1=0;
            var loc3=null;
            var loc4=null;
            this._bgBmp = ResouceConst.getScaleBitmap(ImagesConst.WindowCenterB);
            this._bgBmp.width = 218;
            this._bgBmp.height = 389;
            addChild(this._bgBmp);
            this._bg1 = ResouceConst.getScaleBitmap(ImagesConst.WindowCenterB);
            this._bg1.width = 210;
            this._bg1.height = 82;
            this._bg1.x = 4;
            this._bg1.y = 4;
            addChild(this._bg1);
            this._bg2 = ResouceConst.getScaleBitmap(ImagesConst.WindowCenterB);
            this._bg2.width = this._bg1.width;
            this._bg2.height = 83;
            this._bg2.x = this._bg1.x;
            this._bg2.y = this._bg1.y + this._bg1.height + 2;
            addChild(this._bg2);
            this._bg3 = ResouceConst.getScaleBitmap(ImagesConst.WindowCenterB);
            this._bg3.width = this._bg1.width;
            this._bg3.height = 140;
            this._bg3.x = this._bg1.x;
            this._bg3.y = this._bg2.y + this._bg2.height + 2;
            addChild(this._bg3);
            this._bg4 = ResouceConst.getScaleBitmap(ImagesConst.WindowCenterB);
            this._bg4.width = this._bg1.width;
            this._bg4.height = 70;
            this._bg4.x = this._bg1.x;
            this._bg4.y = this._bg3.y + this._bg3.height + 2;
            addChild(this._bg4);
            this._optTxt = new Object /* flash.text.TextField */();
            this._optTxt.x = 180;
            this._optTxt.y = 10;
            this._optTxt.textColor = 16580298;
            this._optTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._optTxt.selectable = false;
            this._optTxt.addEventListener(flash.events.TextEvent.LINK, this.onOptTextLickHandler);
            this._optTxt.htmlText = "<u><a href=\'event: 0\'>" + HTMLUtil.addColor(Language.getString(20470), "#00ff00") + "</a></u>";
            addChild(this._optTxt);
            this._border = GlobalClass.getBitmap(ImagesConst.PackItemBg);
            this._border.x = 10;
            this._border.y = 10;
            addChild(this._border);
            this._skillItem = new SkillItem();
            this._skillItem.x = this._border.x + 3;
            this._skillItem.y = this._border.y + 3;
            addChild(this._skillItem);
            this._skillName = new Object /* flash.text.TextField */();
            this._skillName.x = this._border.x + this._border.width + 10;
            this._skillName.y = this._border.y + this._border.height - 18;
            this._skillName.textColor = 65280;
            this._skillName.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._skillName.selectable = false;
            addChild(this._skillName);
            this._skillDes = new Object /* flash.text.TextField */();
            this._skillDes.x = this._border.x;
            this._skillDes.y = this._border.y + this._border.height + 2;
            this._skillDes.textColor = 16580298;
            this._skillDes.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._skillDes.wordWrap = true;
            this._skillDes.multiline = true;
            this._skillDes.width = this._bg1.width - 10;
            this._skillDes.mouseEnabled = false;
            addChild(this._skillDes);
            this._oreMapTitle = new Object /* flash.text.TextField */();
            this._oreMapTitle.x = 10;
            this._oreMapTitle.y = this._bg2.y + 8;
            this._oreMapTitle.textColor = 65280;
            this._oreMapTitle.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._oreMapTitle.mouseEnabled = false;
            this._oreMapTitle.text = Language.getString(22000);
            addChild(this._oreMapTitle);
            this._oreMapTarget = Cache.instance.scene.getBossMapPoints();
            var loc2=this._oreMapTarget.length;
            while (loc1 < loc2) 
            {
                loc3 = this._oreMapTarget[loc1];
                (loc4 = new FlyFootTxt()).updateData(loc3);
                loc4.x = 10 + Math.floor(loc1 % 2) * 120;
                loc4.y = this._oreMapTitle.y + 24 + Math.floor(loc1 / 2) * 20;
                addChild(loc4);
                ++loc1;
            }
            this._oreGetTitle = new Object /* flash.text.TextField */();
            this._oreGetTitle.x = 10;
            this._oreGetTitle.y = this._bg3.y + 4;
            this._oreGetTitle.textColor = 65280;
            this._oreGetTitle.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._oreGetTitle.mouseEnabled = false;
            addChild(this._oreGetTitle);
            this._oreGetInfo = new Object /* flash.text.TextField */();
            this._oreGetInfo.x = 10;
            this._oreGetInfo.y = this._oreGetTitle.y + 18;
            this._oreGetInfo.textColor = 16776960;
            this._oreGetInfo.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._oreGetInfo.wordWrap = true;
            this._oreGetInfo.multiline = true;
            this._oreGetInfo.width = this._bg3.width - 10;
            this._oreGetInfo.mouseEnabled = false;
            addChild(this._oreGetInfo);
            var loc5=DailyItemConfig.instance.getInfoByType(DailyRule.OreGet);
            this._oreGetTitle.text = loc5.name;
            this._oreGetInfo.text = Language.getString(22001);
            this._oreActiveTitle = new Object /* flash.text.TextField */();
            this._oreActiveTitle.x = 10;
            this._oreActiveTitle.y = this._oreGetInfo.y + this._oreGetInfo.textHeight + 4;
            this._oreActiveTitle.textColor = 65280;
            this._oreActiveTitle.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._oreActiveTitle.mouseEnabled = false;
            addChild(this._oreActiveTitle);
            this._oreActiveInfo = new Object /* flash.text.TextField */();
            this._oreActiveInfo.x = 10;
            this._oreActiveInfo.y = this._oreActiveTitle.y + 18;
            this._oreActiveInfo.textColor = 16776960;
            this._oreActiveInfo.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._oreActiveInfo.wordWrap = true;
            this._oreActiveInfo.multiline = true;
            this._oreActiveInfo.width = this._bg3.width - 10;
            this._oreActiveInfo.mouseEnabled = false;
            addChild(this._oreActiveInfo);
            loc5 = DailyItemConfig.instance.getInfoByType(DailyRule.OreActive);
            this._oreActiveTitle.text = loc5.name;
            this._oreActiveInfo.htmlText = HTMLUtil.addColor(Language.getString(22002) + Language.getStringByParam(20970, loc5.levelWorld) + "<br>" + Language.getString(22003) + loc5.time + "<br>" + Language.getString(22004), "#ffff00");
            this._energyTitle = new Object /* flash.text.TextField */();
            this._energyTitle.x = 10;
            this._energyTitle.y = this._bg4.y + 8;
            this._energyTitle.textColor = 65280;
            this._energyTitle.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._energyTitle.mouseEnabled = false;
            addChild(this._energyTitle);
            this._energyInfo = new Object /* flash.text.TextField */();
            this._energyInfo.x = 10;
            this._energyInfo.y = this._energyTitle.y + 18;
            this._energyInfo.textColor = 16580298;
            this._energyInfo.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._energyInfo.wordWrap = true;
            this._energyInfo.multiline = true;
            this._energyInfo.width = this._bg4.width - 10;
            this._energyInfo.mouseEnabled = false;
            this._energyInfo.htmlText = HTMLUtil.addColor(Language.getString(22005), "#fcfeca");
            addChild(this._energyInfo);
            return;
        }

        /* internal  */onOptTextLickHandler(arg1: Object /* flash.events.TextEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.SkillBaseInfoHide));
            return;
        }

        public updateData(arg1: SkillInfo): void
        {
            this._skillInfo = arg1;
            this._skillItem.data = this._skillInfo;
            this._skillName.text = this._skillInfo.skillName;
            this._skillDes.text = this._skillInfo.tSkill.skillDescription;
            return;
        }

        public updateNewEnergy(): void
        {
            this._energyTitle.text = Language.getString(22006) + Cache.instance.role.roleInfo.newEnergy + " / " + Cache.instance.role.roleInfo.newEnergyMax;
            return;
        }

        protected /* var */_bgBmp: ScaleBitmap;

        protected /* var */_bg1: ScaleBitmap;

        protected /* var */_bg2: ScaleBitmap;

        protected /* var */_bg3: ScaleBitmap;

        protected /* var */_bg4: ScaleBitmap;

        protected /* var */_optTxt: Object /* flash.text.TextField */;

        protected /* var */_border: Object /* flash.display.Bitmap */;

        protected /* var */_skillItem: SkillItem;

        protected /* var */_skillName: Object /* flash.text.TextField */;

        protected /* var */_skillDes: Object /* flash.text.TextField */;

        protected /* var */_oreMapTitle: Object /* flash.text.TextField */;

        protected /* var */_oreMapTarget: Array<any>;

        protected /* var */_oreGetTitle: Object /* flash.text.TextField */;

        protected /* var */_oreGetInfo: Object /* flash.text.TextField */;

        protected /* var */_oreActiveTitle: Object /* flash.text.TextField */;

        protected /* var */_oreActiveInfo: Object /* flash.text.TextField */;

        protected /* var */_energyTitle: Object /* flash.text.TextField */;

        protected /* var */_energyInfo: Object /* flash.text.TextField */;

        protected /* var */_skillInfo: SkillInfo;
    }
